﻿using System.Text;

namespace Common
{
    /// <summary>
    /// 数值型拓展
    /// </summary>
    public static class DemicalExtension
    {
        /// <summary>
        /// 将int 转为byte[]
        /// </summary>
        /// <param name="num">       </param>
        /// <param name="MSB_first"> </param>
        /// <returns> </returns>
        public static byte[] ToBytes(this int num, bool MSB_first = true)
        {
            if (MSB_first)
            {
                return Encoding.UTF8.GetBytes(num.ToString());
            }
            else
            {
                return null;
            }
        }

        /// <summary>
        /// 将double转为byte[]
        /// </summary>
        /// <param name="num">       </param>
        /// <param name="MSB_first"> </param>
        /// <returns> </returns>
        public static byte[] ToBytes(this double num, bool MSB_first = true)
        {
            return null;
        }
    }
}